package com.bkrebs.moneybud;

import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class GUI extends JFrame {

	GUI meGUI;

	JLabel txtData;

	private static final long serialVersionUID = 9223132810762669826L;

	public GUI() {
		super("MoneyBud");
		meGUI = this;
		setSize(300, 200);
		setLocationRelativeTo(null);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		setLayout(new BorderLayout(5, 5));

		JPanel panel = new JPanel(new GridLayout(4, 1));

		JButton btImport = new JButton("Import");
		btImport.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {
				new ImportFrame(meGUI);
			}
		});

		JButton btAnalyze = new JButton("Analyse");
		txtData = new JLabel("keine Daten importiert");
		JButton btOptions = new JButton("Optionen");

		panel.add(btImport);
		panel.add(btAnalyze);
		panel.add(txtData);
		panel.add(btOptions);

		getContentPane().add(panel);

		// pack();

		setVisible(true);
	}

	public void actualize() {
		txtData.setText("Datasets: " + Main.myDB.getSize());
	}
}
